package com.bhatni.mockprocessor.macro;

import com.bhatni.mockprocessor.Message;
import java.util.Date;
import java.text.SimpleDateFormat;

/**
 * Set the current Date as Macro value. The Macro value param specifies the date format.
 */
public class CurrentDate extends BaseMacro {

    private String dateFormat;

    public void setValue(String value) {
        dateFormat = value;
    }

    public String getResolvedValue(Message in) {
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        return sdf.format(new Date());
    }


}
